package com.aidong.food.biz.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aidong.food.biz.TrnFoodBuyBiz;
import com.aidong.food.dao.TrnFoodBuyDao;

@Service("trnFoodBuyBiz")
public class TrnFoodBuyBizImpl implements TrnFoodBuyBiz {
	
	private TrnFoodBuyDao trnFoodBuyDao;
	
	@Autowired
	public void setTrnFoodBuyDao(TrnFoodBuyDao trnFoodBuyDao) {
		this.trnFoodBuyDao = trnFoodBuyDao;
	}

	/**
	 * 添加购买
	 * 添加订单
	 * @param map
	 */
	@Override
	public void addFoodBuy(Map<String, Object> map) {
		// 购买标记位
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("status", 0);
		paraMap.put("idongId", map.get("idongId").toString());
		trnFoodBuyDao.editBuyFoodFlg(paraMap);
		
		trnFoodBuyDao.addFoodBuy(map);
		trnFoodBuyDao.addFoodBuyOrder(map);
	}

	/**
	 * 订单规则信息
	 * @param ruleId
	 * @return
	 */
	@Override
	public Map<String, Object> getOrderRuleInfo(int ruleId) {
		return trnFoodBuyDao.getOrderRuleInfo(ruleId);
	}
}
